<div class="span9">
  <%= link_to "新增餐厅","/admin/restaurants/new",class:"btn btn-success pull-right" %>
  <h4 class="header"><%=  "所有餐厅" %></h4>
  <% if flash[:notice] %>
      <div class="alert alert-success">
        <button type="button" data-dismiss="alert" class="close">×</button><strong>成功! </strong><%= flash[:notice] %>
      </div>
  <% end %>
  <table id="datatables" class="table table-bordered table-striped responsive">
    <thead>
    <tr>
      <th>名称</th>
      <th>打印机数量</th>
      <th>缩率图</th>
      <th>操作</th>
    </tr>
    </thead>
    <tbody>
    <% @restaurants.each do |restaurant| %>
        <tr>
          <td><%= restaurant.name %></td>
          <td><%= restaurant.printers.count %></td>
          <td>
              <%= image_tag restaurant.attachment.url(:icon),width: 100,height: 100 %>
          </td>
          <td>
            <%= link_to "查看该店铺","/admin/restaurants/#{restaurant.id}",class:"btn btn-info" %>
              <%= link_to "查看打印机","/admin/restaurants/#{restaurant.id}/printers",class:"btn btn-info" %>
              <%= link_to "删除该店铺","/admin/restaurants/#{restaurant.id}",method: :delete,class:"btn btn-danger",data:{confirm:"确定要删除吗?"} %>

          </td>
        </tr>
    <% end %>


    </tbody>
  </table>

</div>